#ifndef FLUXMAP_PARAMETER_H
#define FLUXMAP_PARAMETER_H

/**
 * 用于UI界面的data visuallisition窗口，主要是Flux Map和相关结果的展示，
 * 可以设置一些图像相关的参数
 *      算法类型：raytracing或者analyticalmethod
 *      选择的rev的id
 *      x轴像素个数，y轴像素个数
 *      flux map路径-----用于读入图片
 *
 * 结果：
 *      Total Power
 *      Maximum Flux
 *      Maximumu location
 *
 *
 */
#include <algorithm/shared/utils/Vec2.h>
#include <algorithm/shared/utils/Vec3.h>

#include <QObject>
#include <QString>

namespace solar
{

    class FluxMapParameter : public QObject
    {
            Q_OBJECT
            Q_PROPERTY(int rev_id READ getRevId WRITE setRevId NOTIFY revIdChanged)
            Q_PROPERTY(int pixel_num_x READ getPixelNumX WRITE setPixelNumX NOTIFY pixelNumXChanged)
            Q_PROPERTY(int pixel_num_y READ getPixelNumY WRITE setPixelNumY NOTIFY pixelNumYChanged)
            Q_PROPERTY(int algorithm_type READ getAlgorithmType WRITE setAlgorithmType NOTIFY
                           algorithmTypeChanged)

            Q_PROPERTY(
                float total_power READ getTotalPower WRITE setTotalPower NOTIFY totalPowerChanged)
            Q_PROPERTY(float maximum_flux READ getMaximumFlux WRITE setMaximumFlux NOTIFY
                           maximumFluxChanged)
            Q_PROPERTY(int maximum_flux_location_x READ getMaximumFluxLocationX WRITE
                           setMaximumFluxLocationX NOTIFY maximumFluxLocationXChanged)
            Q_PROPERTY(int maximum_flux_location_y READ getMaximumFluxLocationY WRITE
                           setMaximumFluxLocationY NOTIFY maximumFluxLocationYChanged)

            Q_PROPERTY(QString flux_map_path READ getFluxMapPath WRITE setFluxMapPath NOTIFY
                           fluxMapPathChanged)

        public:
            FluxMapParameter() = default;

            [[nodiscard]] auto getRevId() const -> int;
            [[nodiscard]] auto getPixelNumX() const -> int;
            [[nodiscard]] auto getPixelNumY() const -> int;
            [[nodiscard]] auto getFluxMapPath() const -> QString;
            [[nodiscard]] auto getAlgorithmType() const -> int;
            [[nodiscard]] auto getTotalPower() const -> float;
            [[nodiscard]] auto getMaximumFlux() const -> float;
            [[nodiscard]] auto getMaximumFluxLocationX() const -> int;
            [[nodiscard]] auto getMaximumFluxLocationY() const -> int;

            void setRevId(int rev_id);
            void setPixelNumX(int pixel_num_x);
            void setPixelNumY(int pixel_num_y);
            void setFluxMapPath(QString flux_map_path);
            void setAlgorithmType(int algorithm_type);
            void setTotalPower(float total_power);
            void setMaximumFlux(float maximum_flux);
            void setMaximumFluxLocationX(int location_x);
            void setMaximumFluxLocationY(int location_y);

            // 在cpp中调用的set函数，(在cpp中对参数进行更改时，使用Q_PROPERTY中声明过的函数不起作用，但是调用get函数可以获得参数值)
            void cppSetPixelNumX(int pixel_num_x);
            void cppSetPixelNumY(int pixel_num_y);
            void cppSetFluxMapPath(QString flux_map_path);
            void cppSetTotalPower(float total_power);
            void cppSetMaximumFlux(float maximum_flux);
            void cppSetMaximumFluxLocationX(int location_x);
            void cppSetMaximumFluxLocationY(int location_y);

        signals:

            auto revIdChanged() -> QString;
            auto pixelNumXChanged() -> QString;
            auto pixelNumYChanged() -> QString;
            auto fluxMapPathChanged() -> QString;
            auto algorithmTypeChanged() -> QString;
            auto totalPowerChanged() -> QString;
            auto maximumFluxChanged() -> QString;
            auto maximumFluxLocationXChanged() -> QString;
            auto maximumFluxLocationYChanged() -> QString;

        private:
            int rev_id_{0}; // 要画flux map的接收器的id
            Vec2 pixel_num_{1, 1}; // 两个方向上的像素个数--------在算法中已经确定好了，不可以更改
            int algorithm_type_; // 算法类型----  0: raytracing    1: analytical method
            // map存储的qrc路径----注意：：：图片要想被qml读取，必须要在qml.qrc文件中写明路径
            QString flux_map_path_{"qrc:/outputfiles/flux_map/cylinder.png"}; // flux

            float total_power_{10.0000F};       // 总的辐射通量
            float maximum_flux_{100.0};        // 最大辐射通量
            Vec2 maximum_flux_location_{2, 3}; // 最大辐射通量的像素位置
    };

} // namespace solar

#endif
